//
// Created by tanke on 23-11-28.
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int cmp(const void* val_1, const void* val_2)
{
    int* ptr_val_1 = (int*)val_1;
    int* ptr_val_2 = (int*)val_2;

    return *ptr_val_1 - *ptr_val_2;
}

bool divideArray(int* nums, int numsSize)
{
    qsort(nums, numsSize, sizeof(int), cmp);

    for (int i = 0; i < numsSize - 1; i += 2) {
        if (nums[i] != nums[i + 1]) {
            return false;
        }
    }

    return true;
}

int main(void)
{
    int nums[6] = {3, 2, 3, 2, 2, 2};
    printf("%d\n", divideArray(nums, 6l));
    return 0;
}
